Testbench Structure

In the previous section both the design and the test code were located in the same file. This approach was only taken for demonstration purposes and is not recommended in the general case. Typical testbench code - such as text output and assert statements - can not be synthesized and will at the very least create a number of unnecessary warnings from the tool. Also testbench code can have similar complexity as design code and if it's well structured, is quite likely to be reusable.

The following diagram shows a typical testbench structure:

In this example the top level entity (testbench) instantiates four components: the processor transactor, the RAM model, the I2C-Controller transactor and the design which needs to be tested (DUT). Each testbench component and the top level testbench are in their own files, the DUT is also in a separate file. The testbench components produce stimulus and verify the response from the DUT.


previous Index next